function [models_struct,raw_data,is_nan]=create_models_from_dir(mdir)

% This function is a wrapper function for "create_models_from_images", with input as the directory
% of all the input matrices for the model creation.

% Function Inputs:
%-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
% mdir - string containing the directory of all the input matrices for "create_models_from_images".
%-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

% Function Outputs:
%-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
%  models_struct - struct of models that are the output from a classifier.
%-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
% raw_data - a matrix of all the regions' features, in size of num_of_featuresXnum_of_regions for all
% then input matrices together.
%-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
% is_nan - 1 if model is not valid (NaN), 0 otherwise.
%-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

files=dir([mdir '\*.mat']);
str='';
for i=1:length(files)
    str=sprintf('%s,''%s''',str,fullfile(mdir,files(i).name));
end
if (length(str)) 
    str(1)=[];
    eval(sprintf(' [models_struct,raw_data,is_nan]=create_models_from_images(%s);',str));
else
    [models_struct,raw_data,is_nan]=deal(0);
end



